import Taro from '@tarojs/taro'
var apiurl = "http://192.168.200.164:8484/";

function post(controller, data, cb) {
  let sessionKey = Taro.getStorageSync('sessionKey');
  if (sessionKey) {
    data = { ...data, session_key: sessionKey };
  }
  return Taro.request({
    url: apiurl + controller,
    data: data,
    method: 'post',
    header: { 'Content-Type': 'application/x-www-form-urlencoded' },
    success: function (res) {
      return res.data
    },
    fail: function (res) {
      return typeof cb == "function" && cb(false)
    }
  })

}



module.exports = {
  post,//post请求 

}